package com.manli.api.controller;

import java.util.Arrays;
import java.util.Map;
import com.manli.api.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.manli.api.base.annotation.Permissions;
import com.manli.api.pojo.QueryParams;
import com.manli.api.dto.ManliSpaceLog;
import com.manli.api.service.ManliSpaceLogService;



/**
 * 动态评论
 *
 * @author manli
 * @email 
 * @date 2020-08-27 09:43:03
 */
@Api(value="/manlispacelog", tags="动态评论")
@RestController
@RequestMapping("api/manlispacelog")
public class ManliSpaceLogController {
    @Autowired
    private ManliSpaceLogService manliSpaceLogService;

    /**
     * 列表
     */
    @ApiOperation(value = "动态评论列表",notes = "")
    @PostMapping("/list")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result list(@RequestBody QueryParams params){
        return manliSpaceLogService.queryPage(params);
    }

    /**
     * 全部数据信息
     */
    @ApiOperation(value = "动态评论全部数据信息",notes = "")
    @PostMapping("/all")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result all(){
        return manliSpaceLogService.queryAll();
    }

    /**
     * 单条信息
     */
    @ApiOperation(value = "动态评论单条信息",notes = "动态评论单条信息")
    @GetMapping("/info/{manliSpaceLogId}")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result info(@PathVariable("manliSpaceLogId") Integer manliSpaceLogId){
        return manliSpaceLogService.getById(manliSpaceLogId);
    }

    /**
     * 保存
     */
    @ApiOperation(value = "动态评论保存",notes = "动态评论保存")
    @PostMapping("/save")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result save(@RequestBody ManliSpaceLog manliSpaceLog){
        return manliSpaceLogService.save(manliSpaceLog);
    }

    /**
     * 修改
     */
    @ApiOperation(value = "动态评论修改",notes = "动态评论修改")
    @PostMapping("/update")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result update(@RequestBody ManliSpaceLog manliSpaceLog){
        return manliSpaceLogService.updateById(manliSpaceLog);
    }


    /**
     * 删除多条数据
     */
    @ApiOperation(value = "动态评论删除",notes = "动态评论删除")
    @ApiImplicitParam(name = "manliSpaceLogIds", value = "id数组,json字符串",dataType = "id数组,json字符串", required = true)
    @PostMapping("/deleteIds")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result deleteIds(@RequestBody Integer[] manliSpaceLogIds){
        return manliSpaceLogService.removeByIds(Arrays.asList(manliSpaceLogIds));
    }

}
